#

[[ $- != *i* ]] && return

shopt -s autocd

alias ls="ls --color=auto"
alias ll="ls -lFG"
alias open="xdg-open"
alias srvpy="python3 -m http.server 8080 -d $PWD"

#void
if [ -f /etc/os-release ]; then
				. /etc/os-release
				if [ "$DISTRIB_ID" = "void" ]; then
								alias xrm="sudo xbps-remove"
				fi
				unset NAME ID DISTRIB_ID PRETTY_NAME
fi

print256colors(){
for clbg in {40..47} {100..107} 49 ; do
    #Foreground
    for clfg in {30..37} {90..97} 39 ; do
        #Formatting
        for attr in 0 1 2 4 5 7 ; do
            #Print the result
            echo -en "\e[${attr};${clbg};${clfg}m ^[${attr};${clbg};${clfg}m \e[0m"
        done
        echo #Newline
    done
done
}

git_prompt() {
  BRANCH=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/*\(.*\)/\1/' -e 's/ //')
	GIT_HASH=$(git log --branches --not --remotes 2>/dev/null | head -n1 | sed -e 's|commit ||g')

  if [ ! -z $BRANCH ]; then
		echo -n -e "\e[1;90m${BRANCH}\e[0m"
		
		if [ ! -z $GIT_HASH ]; then
			echo -n -e "\e[1;32m \u2794\e[0m"
		fi

    if [ ! -z "$(git status --short)" ]; then
      echo -e "\e[1;31m \u2716 \e[0m"
    else
      echo -e "\e[1;32m \u2714\e[0m $PUSHED"
    fi
  fi
}

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"

export PS1='\[\033[01;34m\]\w\[\033[00m\] $(git_prompt)\[\033[01;34m\]>\[\033[00m\] '

case "$TERM" in
        xterm*|rxvt*)
                PS1="\[\e]0;\u: \w\a\]$PS1" ;;
        *)
                ;;
esac
